
<div class="content-category">
    <div class="jcrollbar">

<ul <?php if ($this->getCollapsed() && !$this->getHasSelection() && !('catalogsearch' == Mage::app()->getRequest()->getModuleName())) echo 'style="display:none"'?>  >
    <?php $number = count($this->getItems()); ?> 
    <?php if($number!=0): ?>
        <?php if (in_array($this->getDisplayType(), array(0, 2))): // default or categories with subcategories?>
            <?php foreach ($this->getItems() as $_item): ?>

                <li>

                    <?php if ($_item->getIsSelected()) :?>
                         
                            <label><?php echo $_item->getLabel() ?></label>
                        <?php else:?>
                        <?php 
                            $url = $_item->getUrl();
                            $url = str_replace("&amp;","&",$url);
                        ?>

                        <a href="<?php echo $this->urlEscape($url) ?>">
                            <label><?php echo $_item->getLabel() ?></label>
                        </a>

                    <?php endif;?>
                    <?php if ($_item->getCount() > 0):?>
                        (<?php echo $_item->getCount() ?>)
                    <?php endif;?>
                </li>
            <?php endforeach ?>
        <?php elseif ($this->getDisplayType() == 3): // static expandable 2 level tree?>
            <?php foreach ($this->getItems() as $_item): ?>
                <?php
                    $level      = $_item->getLevel();
                    $additional = $_item->getIsFolded() ? 'style="display:none"' : '';

                    $class      = 'amshopby-cat amshopby-cat-level-' . $level;
                    if (1 != $level){
                        $class .= ' amshopby-cat-parentid-' . $_item->getId();    
                    }
                        
                    $showIcon = (1 == $level && $_item->getHasChildren());
                    $icon = ($_item->getIsChildSelected()) ? 'minus': 'plus';
                ?>
                <li class="<?php echo $class?>" <?php echo $additional?>>
                    <?php if ($showIcon): ?><span id="amshopby-cat-id-<?php echo $_item->getId()?>" class="amshopby-plusminus <?php echo $icon?>"></span><?php endif ?>
                    <a <?php if ($_item->getIsSelected()):?>class="amshopby-cat-selected"<?php endif?> href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>
                    (<?php echo $_item->getCount() ?>)
                </li>
            <?php endforeach ?>
        <?php elseif (1 == $this->getDisplayType()): // dropdown ?>
            <li>
                <select onchange="if (this.value) setLocation(this.value)" class="amshopby-select">
                    <!-- uncomment to show Filter name in the dropdown <option value=""><?php echo $this->getName() ?></option>-->
                    <option value=""></option>
                    <?php foreach ($this->getItems() as $_item): ?>
                        <option  
                                value="<?php echo $this->urlEscape($_item->getUrl()) ?>" 
                                <?php if ($_item->getIsSelected()):?>selected="selected"<?php endif;?>>
                                <?php echo str_repeat('&nbsp;&nbsp;', max(0, $_item->getLevel() - 1))?>
                                <?php echo $_item->getLabel() ?> (<?php echo $_item->getCount() ?>)</option>
                    <?php endforeach ?>
                </select>
            </li>
        <?php endif ?>
    <?php else: ?>
        <!-- get all category level 1 -->
            <?php 
                /*
                $rootCatalog = Mage::getModel("catalog/category")->load(ROOT_CATEGORY);
                $listCate = $rootCatalog->getChildrenCategories(); ?>
                <?php //echo count($listCate); ?>
                <?php if(count($listCate) > 0): ?>
                    <?php foreach ($listCate as $_cate): ?>
                        <li>
                            
                            <?php $catId = $_cate->getId(); ?>
                            <?php $linkSearch = $this->getUrl("catalogsearch/result/") . "?cat=".$catId."&q=1"; ?>
                            <?php $catIdRequest = $this->getRequest()->getParam("cat"); ?>
                            <?php if($catId == $catIdRequest): ?>
                                <a class="amshopby-attr-selected" href="<?php echo $this->urlEscape($linkSearch) ?>">
                                    <label><?php echo $_cate->getName() ?></label>
                                </a>
                            <?php else: ?>
                                <a class="amshopby-attr" href="<?php echo $this->urlEscape($linkSearch) ?>">
                                    <label><?php echo $_cate->getName() ?></label>
                                </a>
                            <?php endif; ?>
                            
       
                        </li>
                    <?php endforeach;?>        
                <?php endif; ?>
                 
            
                 * 
                 */
               ?>         
            <?php endif; ?>
         </ul>

    </div>
</div>
<script type="text/javascript">
    jQuery(document).ready(function(){

    });
</script>

    